package pendingFeatureCode

import (
	"log"
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/gorilla/websocket"
)

// 路由
var upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
	CheckOrigin: func(r *http.Request) bool {
		return true
	},
}

func Handler(c *gin.Context) {
	conn, err := upgrader.Upgrade(c.Writer, c.Request, nil)
	if err != nil {
		log.Fatalln(err)
	}

	conn.WriteMessage(websocket.TextMessage, []byte("hello,world"))
	conn.Close()
}

func RegisterPendingRoutes(r *gin.Engine) {
	r.GET("/stream", streamSSE)
}
